﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SWCInvoice.Utils.WindowUtils;

namespace SWCInvoice.Windows
{
    /// <summary>
    /// Interaction logic for InputDialog.xaml
    /// </summary>
    public partial class InputDialog : Window
    {
        #region Fields

        /// <summary>
        /// The dialog content result
        /// </summary>
        string _dialogcontentResult;

        #endregion

        #region Properties

        /// <summary>
        /// The dialog content result
        /// </summary>
        public string DialogContentResult
        {
            get 
            {
                return _dialogcontentResult; 
            }
            set
            {
                _dialogcontentResult = value;
            }
        }

        #endregion

        public InputDialog(string title, string information, string defaultValue)
        {
            InitializeComponent();

            this.Title = title;
            lblTitel.Content = title;
            lblInformation.Content = information;
            tbxInput.Text = defaultValue;

            //Expander_Collapsed(null, null);
        }

        protected override void OnSourceInitialized(EventArgs e)
        {
            IconHelper.RemoveIcon(this);
        }

        /// <summary>
        /// Accept the input text and close the window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            DialogContentResult = tbxInput.Text;
            DialogResult = true;
            this.Close();
        }

        /// <summary>
        /// Close the window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Expander_Collapsed(object sender, RoutedEventArgs e)
        {
            if (expInformation.IsExpanded)
                this.Height = rowOne.ActualHeight + 200 + rowThree.ActualHeight+30;
            if (!expInformation.IsExpanded)
                this.Height = rowOne.ActualHeight + 60 + rowThree.ActualHeight+30;
        }

    }
}
